# Longitude conversion 0~360 to -180~180

**URL:** <https://forum.ecmwf.int/t/longitude-conversion-0-360-to-180-180/1152>\
**Category:** Datasets and Usage\
**Tags:** cams, c3s, conversion\
**Created:** [27 August 2019 09:18 UTC](https://forum.ecmwf.int/t/longitude-conversion-0-360-to-180-180/1152 "2019-08-27T09:18:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xiaobo\_Yang](https://forum.ecmwf.int/letter_avatar_proxy/v4/letter/x/e495f1/32.png) [@Xiaobo\_Yang](https://forum.ecmwf.int/u/Xiaobo_Yang)\
**Post date:** [27 August 2019 09:18 UTC](https://forum.ecmwf.int/t/longitude-conversion-0-360-to-180-180/1152/1 "2019-08-27T09:18:19Z")

</div>

Longitude can be between 0~360 (long3) and -180~180 (long1). To convert from long3 to long1, use the formula below:

```
long1=mod((long3+180),360)-180
# Python:

long1 = (long3 + 180) % 360 - 180

# Or:

if long3 \<= 180: long1 = long3  
else: long1 = long3 - 360
```

To illustrate the values:

```
long3: 180, 181, ..., 359, 360/0, 1, ..., 179, 180
long1: -180, -179, ... -1, 0, 1, ..., 179, 180
```
